unit dmsb_MachineTempMaster;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, dmModule, FR_DSet, FR_DBSet, DB, ADODB;

type
  Tdtmsb_MachineTempMaster = class(TdtmModule)
    adsMasterEditBillID: TStringField;
    adsMasterEditBillNo: TStringField;
    adsMasterEditWriter: TStringField;
    adsMasterEditWriteTime: TDateTimeField;
    adsMasterEditModifier: TStringField;
    adsMasterEditModifyTime: TDateTimeField;
    adsMasterEditRemark: TStringField;
    adsDetail: TADODataSet;
    adsDetailID: TStringField;
    adsDetailBillID: TStringField;
    adsDetailWriter: TStringField;
    adsDetailWriteTime: TDateTimeField;
    adsDetailModifier: TStringField;
    adsDetailModifyTime: TDateTimeField;
    adsDetailRemark: TStringField;
    frdsDetail: TfrDBDataSet;
    adsUserCompany: TADODataSet;
    adsMasterEditHasCheck: TBooleanField;
    adsMasterEditChecker: TStringField;
    adsMasterEditCheckTime: TDateTimeField;
    adsBrowseDetail: TADODataSet;
    StringField1: TStringField;
    StringField2: TStringField;
    StringField10: TStringField;
    DateTimeField1: TDateTimeField;
    StringField11: TStringField;
    DateTimeField2: TDateTimeField;
    StringField12: TStringField;
    adsMasterBillID: TStringField;
    adsMasterBillNo: TStringField;
    adsMasterBillType: TStringField;
    adsMasterHasCheck: TBooleanField;
    adsMasterChecker: TStringField;
    adsMasterCheckTime: TDateTimeField;
    adsMasterWriter: TStringField;
    adsMasterWriteTime: TDateTimeField;
    adsMasterModifier: TStringField;
    adsMasterModifyTime: TDateTimeField;
    adsMasterRemark: TStringField;
    adsMasterEditBillType: TStringField;
    adsMasterEditDeptID: TStringField;
    adsMasterDeptID: TStringField;
    adsDetailOrderID: TIntegerField;
    adsBrowseDetailOrderID: TIntegerField;
    adsMasterTitle: TStringField;
    adsMasterEditTitle: TStringField;
    adsDetailParts: TStringField;
    adsDetailCycle: TStringField;
    adsDetailOilType: TStringField;
    adsDetailOilMass: TFloatField;
    adsDetailContent: TStringField;
    adsBrowseDetailParts: TStringField;
    adsBrowseDetailCycle: TStringField;
    adsBrowseDetailOilType: TStringField;
    adsBrowseDetailOilMass: TFloatField;
    adsBrowseDetailOilMassMemo: TStringField;
    adsBrowseDetailContent: TStringField;
    adsDetailOilMassMemo: TStringField;
    procedure adsDetailNewRecord(DataSet: TDataSet);
  private
    { Private declarations }
  protected
    procedure ModuleInit;override;
  public
    { Public declarations }
    procedure OpenEditDataSet;override;
  end;

var
  dtmsb_MachineTempMaster: Tdtmsb_MachineTempMaster;
  FOnChangeFlag: Integer = 0;

implementation

uses uCalcData, uConst, uShare, uSQL, uMsgBox, dmConnect;

{$R *.dfm}

{ Tdtmsb_MachineTempMaster }

procedure Tdtmsb_MachineTempMaster.ModuleInit;
begin
  inherited;
  FUniqueTable := 'sb_MachineTempMaster';
  FMasterKeyField := 'BillID';
end;

procedure Tdtmsb_MachineTempMaster.OpenEditDataSet;
begin
  FMasterEditTable := 'sb_MachineTempMaster';
  FMasterKeyField := 'BillID';
  inherited;

end;

procedure Tdtmsb_MachineTempMaster.adsDetailNewRecord(DataSet: TDataSet);
begin
  inherited;
  SetWriteInfo(DataSet);
  DataSet.FieldByName('ID').ReadOnly := False;
  DataSet.FieldByName('ID').AsString := uShare.GetCurMaxID('sb_MachineTempDetail', nil, 'ID');
  DataSet.FieldByName('BillID').ReadOnly := False;
  DataSet.FieldByName('BillID').AsString := adsMasterEdit.FieldByName('BillID').AsString;
  if (DataSet.FieldByName('OrderID').AsInteger<=0) then
  begin
    DataSet.FieldByName('OrderID').ReadOnly := False;
    DataSet.FieldByName('OrderID').AsInteger := DataSet.RecordCount+1;
  end;
end;

end.
